package com.sali.asyncollection.service;



import com.sali.asyncollection.model.BaseRspDTO;
import com.sali.asyncollection.service.impl.strategy.TaskStrategyFactory;

import java.util.concurrent.Callable;

/**
 * @description:
 * @author: zhang hang
 * @date: 2023/3/15 21:09.
 * @version: 1.0
 */
public class BaseTaskCommand2 implements Callable<BaseRspDTO<Object>> {


    private String key;
    private String req;
    private TaskStrategyFactory taskStrategyFactory;

    public BaseTaskCommand2(String key, String req, TaskStrategyFactory taskStrategyFactory) {
        this.key = key;
        this.req = req;
        this.taskStrategyFactory = taskStrategyFactory;
    }

    @Override
    public BaseRspDTO<Object> call() throws Exception {
        return taskStrategyFactory.executeTask(key, req);
    }
}
